//
//  XJChatMainTableViewCell.m
//  XinJiangMall
//
//  Created by Tzyang on 2018/4/12.
//  Copyright © 2018年 Tzyang. All rights reserved.
//

#import "XJChatMainTableViewCell.h"


@implementation XJChatMainTableViewCell

+ (instancetype)cellWithTableView:(UITableView *)tableView{
    
    static NSString * cellID = @"XJChatMainTableViewCell";
    XJChatMainTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell==nil) {
        cell = [[XJChatMainTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        cell.backgroundColor = WHITE_COLOR;
    }
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setupSubviews];
    }
    return self;
}

- (UIImageView *)xjChatImgV{
    
    if (!_xjChatImgV) {
        UIImageView * xjChatImgV = [UIImageView new];
        self.xjChatImgV = xjChatImgV;
        [self.contentView addSubview:xjChatImgV];
    }
    return _xjChatImgV;
}

- (UILabel *)xjChatLab{
    if (!_xjChatLab) {
        UILabel * xjChatLab = [UILabel new];
        self.xjChatLab = xjChatLab;
        [self.contentView addSubview:xjChatLab];
    }
    return _xjChatLab;
}

- (UIImageView *)xjChatRImgV{
    if (!_xjChatRImgV) {
        UIImageView * xjChatRImgV = [UIImageView new];
        self.xjChatRImgV = xjChatRImgV;
        [self.contentView addSubview:xjChatRImgV];
    }
    return _xjChatRImgV;
}

- (void)setupSubviews{
    self.xjChatImgV.sd_layout
    .leftSpaceToView(self.contentView, ADAPTWidth(25))
    .centerYEqualToView(self.contentView)
    .widthIs(22)
    .heightIs(22);
    
    self.xjChatLab.font = XJFONTSET_R(15);
    self.xjChatLab.textColor = XJCOLOR_RGB(3, 3, 3);
    self.xjChatLab.sd_layout
    .leftSpaceToView(self.xjChatImgV, ADAPTWidth(8))
    .centerYEqualToView(self.contentView)
    .widthIs(ADAPTWidth(70))
    .heightIs(ADAPTHeight(21));
    
    
    self.xjChatRImgV.image= [UIImage imageNamed:@"direction_right_black"];
    self.xjChatRImgV.sd_layout
    .centerYEqualToView(self.contentView)
    .rightSpaceToView(self.contentView, ADAPTWidth(26))
    .widthIs(12)
    .heightIs(12);
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
